import http from "@/utils/fetch";
import qs from 'qs';

/**
 * 订单管理
 */
// 订单列表
export function orderList(params) {
    return http.post("/Supplier/Order/orderList", params);
}
// 获取订单编辑数据
export function getOrderData() {
    return http.post("/Supplier/Order/getOrderData");
}
// 编辑订单数据
export function editOrderData(params) {
    return http.post("/Supplier/Order/editOrderData", params, true);
}
// 签署担保合同
export function createCreditCompany(params) {
    return http.post("/Supplier/Order/createCreditCompany", params, true);
}
// 查看风控大数据
export function getRiskData(params) {
    return http.post("/Supplier/Order/getRiskData", params, true);
}
// 查看全景雷达报告
export function getRadarData(params) {
    return http.post("/Supplier/Order/getRadarData", params, true);
}
// 查看学历
export function getEduData(params) {
    return http.post("/Supplier/Order/getEduData", params, true);
}
// 查看蚂蚁风控
export function getAntData(params) {
    return http.post("/Supplier/Order/getAntData", params, true);
}
// 查看风控大数据剩余次数
export function getBooleaRiskNum(params) {
    return http.post("/Supplier/Order/getBooleaRiskNum", params);
}
// 查看征信
// export function getCreditData(params) {
//   return http.post("/Supplier/Order/getCreditData", params,true);
// }
// 查看新版征信
export function getCreditNewData(orderId) {
    return http.post("/Supplier/Order/getCreditNewData", { orderId }, true);
}
// 查看征信剩余次数
export function getCreditRiskNum(params) {
    return http.post("/Supplier/Order/getCreditRiskNum", params);
}
// 获取每期租金
export function getLeaseRent(orderId) {
    return http.post("/Supplier/Order/getLeaseRent", { orderId });
}
// 手动风控
export function orderRisk(params) {
    return http.post("/Supplier/Order/orderRisk", params, true);
}
// 查看租期
export function getLease(orderId) {
    return http.post("/Supplier/Order/getLease", { orderId });
}
// 设置修改收货地址
export function setAddress(params) {
    return http.post("/Supplier/Order/setAddress", params, true);
}
// 添加设备编号
export function setDeviceNumber(params) {
    return http.post("/Supplier/Order/setDeviceNumber", params, true);
}
// 添加客服备注
export function setOrderRemark(params) {
    return http.post("/Supplier/Order/setOrderRemark", params, true);
}
// 获取客服备注记录
export function getOrderRemark(params) {
    return http.post("/Supplier/Order/getOrderRemark", params);
}
// 查看流水记录
export function getLeaseFlow(orderNo) {
    return http.post("/Supplier/Order/getLeaseFlow", { orderNo });
}
// 获取物流公司列表
export function getLogisticAll() {
    return http.post("/Supplier/Order/getLogisticAll");
}
// 发货
export function deliverGoods(params) {
    return http.post("/Supplier/Order/deliverGoods", params, true);
}
// 导出签收凭证word
export function downloadWord(params) {
    const baseURL = `${process.env.VUE_APP_BASE_API}`;
    const url = '/Download/Order/express';
    const paramsObj = { ...params, export: true };
    const paramsStr = `?${qs.stringify(paramsObj)}`;
    console.log(baseURL + url + paramsStr);
    window.location.href = baseURL + url + paramsStr;
}
// 确认收货
export function confirmGoods(params) {
    return http.post("/Supplier/Order/confirmGoods", params, true);
}
// 获取账单详情
export function getLeaseInfo(orderId) {
    return http.post("/Supplier/Order/getLeaseInfo", { orderId });
}
// 获取物流信息
export function getLogisticInfo(params) {
    return http.post("/Supplier/Order/getLogisticInfo", params);
}
// 补充发货确认收货凭证
export function setOrderVoucher(params) {
    return http.post("/Supplier/Order/setOrderVoucher", params, true);
}
// 获取订单状态列表
export function getOrderStatus() {
    return http.post("/Supplier/Order/getOrderStatus");
}
// 订单列表导出
export function orderListExport(params) {
    return http.export("/Supplier/Order/orderListExport", params, "订单列表");
}

// 花呗订单列表
export function orderHuaBeiList(params) {
    return http.post("/Supplier/Order/orderHuaBeiList", params);
}
// 花呗订单列表-导出
export function orderHuaBeiExport(params) {
    return http.export(
        "/Supplier/Order/orderHuaBeiExport",
        params,
        "花呗订单列表"
    );
}
// 买断订单列表
export function orderBuyOutList(params) {
    return http.post("/Supplier/Order/orderBuyOutList", params);
}
// 买断订单列表-导出
export function orderBuyOutListExport(params) {
    return http.export(
        "/Supplier/Order/orderBuyOutListExport",
        params,
        "买断订单列表"
    );
}
// 签约待付款订单列表
export function orderSignedList(params) {
    return http.post("/Supplier/Order/orderSignedList", params);
}
// 签约待支付订单列表-导出
export function orderSignedListExport(params) {
    return http.export(
        "/Supplier/Order/orderSignedListExport",
        params,
        "签约待支付订单列表"
    );
}
// 交易完成
export function orderFinish(orderId) {
    return http.post("/Supplier/Order/orderFinish", { orderId }, true);
}
// 订单同意归还
export function orderReturnAgree(orderId) {
    return http.post("/Supplier/Order/orderReturnAgree", { orderId }, true);
}
// 订单归还审核拒绝
export function orderReturnRefuse(params) {
    return http.post("/Supplier/Order/orderReturnRefuse", params, true);
}
// 订单确认归还
export function orderComfirmReturn(orderId) {
    return http.post("/Supplier/Order/orderComfirmReturn", { orderId }, true);
}
// 订单归还完成
export function orderReturnFinish(orderId) {
    return http.post("/Supplier/Order/orderReturnFinish", { orderId }, true);
}
// 订单关闭
export function orderClose(orderId) {
    return http.post("/Supplier/Order/orderClose", { orderId }, true);
}
// 订单审核拒绝
export function orderRefuse(orderId) {
    return http.post("/Supplier/Order/orderRefuse", { orderId }, true);
}

// 续租订单列表
export function orderRenewalList(params) {
    return http.post("/Supplier/Order/orderRenewalList", params)
}
// 修改订单物流信息
export function editOrderExpress(params) {
    return http.post("/Supplier/Order/editOrderExpress", params, true)
}
// 购买保险
export function insuranceCreate(params) {
    return http.post("/Antchain/zlb/insuranceCreate", params);
}

// 单条订单数据
export function orderDetail() {
    return http.post("Supplier/Order/orderDetail")
}
// 搜索订单
export function setNextOrder(orderId) {
    return http.post("Supplier/Order/setNextOrder", { orderId })
}
export function handleOrder(params) {
    return http.post("Supplier/Order/handleOrder", params)
}
// 审批通过
export function passOrderApproval(orderId) {
    return http.get("/Supplier/Order/passOrderApproval", { orderId });
}
// 审批驳回
export function rejectOrderApproval(params) {
    return http.get("/Supplier/Order/rejectOrderApproval", params);
}
// 取消公证
export function cancelOrderApproval(params) {
    return http.get("/Supplier/Order/cancelOrderApproval", params);
}
// 上公证
export function setOrderLease(params) {
    return http.post("/Supplier/Order/setOrderLease", params);
}
// 执行第一次征信请求
export function getFirstCreditNewData(params) {
    return http.post("/Supplier/Order/getFirstCreditNewData", params);
}
// 查询二要素
export function getNetwork(params) {
    return http.post("/Supplier/Order/getNetwork", params);
}
// 获取二要素记录
export function getNetworkDetail(orderId) {
    return http.get("/Supplier/Order/getNetworkDetail", { orderId });
}
// 转回内部
export function setOrderEdit(orderId) {
    return http.post("/Supplier/Order/setOrderEdit", { orderId });
}
// 转回内部
export function getMobileData(params) {
    return http.post("/Supplier/Order/getMobileData", params, true);
}
// 获取探针C+全景雷达
export function getBehaviorData(params) {
    return http.post("/Supplier/Order/getBehaviorData", params, true);
}
// 天狼星风控大数据
export function getNewRiskData(params) {
    return http.post("/Supplier/Order/getNewRiskData", params);
}
// 线下还款
export function offLineRepay(params) {
    return http.post("/Supplier/Order/offLineRepay", params);
}